fix(apple): restore WhenUnlockedThisDeviceOnly for SE key access control#160
Merged
Merged
Conversation
PR #158 blanket-replaced all protection classes to AfterFirstUnlockThisDeviceOnly, including makeAccessControl() which sets the Secure Enclave key's access control at generation time. This broke CryptoKit's touchIDAuthenticationAllowableReuseDuration — every sign required Touch ID instead of caching biometric auth. Since the SE key's access control is immutable after creation, fixing this requires regenerating all affected keys. The keychain wrapping key (keychain_store) correctly uses AfterFirstUnlockThisDeviceOnly for sleep/wake survival. The SE key access control must use WhenUnlockedThisDeviceOnly for biometric caching. These are separate decisions with different requirements. Also adds AGENTS.md with protection class safety rules and updates CLAUDE.md to document the split, so this class of mistake is prevented in future changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AfterFirstUnlockThisDeviceOnly, includingmakeAccessControl()which controls the SE key's access control at generation time. This broke CryptoKit'stouchIDAuthenticationAllowableReuseDuration— every sign required Touch ID instead of caching biometric auth within the TTL window.makeAccessControl()back tokSecAttrAccessibleWhenUnlockedThisDeviceOnlywhile keepingkeychain_store()atkSecAttrAccessibleAfterFirstUnlockThisDeviceOnly(correct for sleep/wake survival).AGENTS.mdwith protection class safety rules and updatesCLAUDE.mdto document the split, preventing this class of mistake from recurring.Impact: Keys generated after the PR #158 change have the wrong SE access control baked into the SEP. Since the SE key access control is immutable after creation, affected keys must be regenerated.
Test plan
cargo test --workspacepassescargo clippy --workspace --all-targets -- -D warningscleanAfterFirstUnlockThisDeviceOnly)